package com.edu.boot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.edu.boot.common.TokenUtil;
import com.edu.boot.config.UserContext;
import com.edu.boot.entity.BusinessShop;
import com.edu.boot.entity.Recruitment;
import com.edu.boot.entity.Vo.BusinessShopAllInfoVo;
import com.edu.boot.mapper.RecruitmentMapper;
import com.edu.boot.mapper.SResumeMapper;
import com.edu.boot.service.BusinessShopService;
import com.edu.boot.mapper.BusinessShopMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
* @author 。
* @description 针对表【business_shop】的数据库操作Service实现
* @createDate 2023-11-16 13:33:14
*/
@Service
public class BusinessShopServiceImpl extends ServiceImpl<BusinessShopMapper, BusinessShop>
    implements BusinessShopService{
    @Resource
    private BusinessShopMapper businessShopMapper;

    @Autowired
    private RecruitmentMapper recruitmentMapper;
    public List<BusinessShopAllInfoVo> getBusinessShopInfoById(Integer id){
        return businessShopMapper.getBusinessShopInfoById(id);
    }
    public IPage<BusinessShopAllInfoVo> getBusinessShopInfoByLikeName(Page<BusinessShopAllInfoVo> page,String str){
        return businessShopMapper.getBusinessShopInfoByLikeName(page,str);
    }
    public IPage<Recruitment> getBusinessShopInfo(Page<Recruitment> page, Recruitment recruitment){
        LambdaQueryWrapper<Recruitment> wrapper = new LambdaQueryWrapper<Recruitment>()
                .eq(StringUtils.isNotBlank(recruitment.getRecName()), Recruitment::getRecName, recruitment.getRecName())
                .eq(Objects.nonNull(recruitment.getRecType()), Recruitment::getRecType, recruitment.getRecType())
                .eq(Recruitment::getBId, UserContext.getUserId())
                .or("1".equals(UserContext.getPid()));
        return recruitmentMapper.selectPage(page,wrapper);
    }
}




